<?php
	class M_books extends CI_Model 
	{
		private $book_table = 'book_bank';
		function __construct()
		{
			parent::__construct();
		}
		
		function get_book_details($id)
		{
			$res = $this->db->get_where($this->book_table, array('id' => $id));
			if($res->num_rows() == 1)
			{
				return $res->row();
			}
			else return FALSE;
		}
		
		function is_book_available_for_sale($id)
		{
			$this->db->select('Status, In_stock');
			$res = $this->db->get_where($this->book_table, array('id' => $id));
			if($res->num_rows() == 1)
			{
				$info = $res->row();
				return ($info->Status && $info->In_stock) ? TRUE : FALSE;
			}
			return FALSE;
		}
	}